package com.restaurant.application.minifacade.data;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.stream.Collectors;

public class MainBO implements PickableBean {
    
    public static final String FN_NICKNAME = "nickName";
    public static final String FN_AVATARURL = "avatarUrl";
    public static final String FN_LEVEL = "level";
    public static final String FN_LEVELNAME = "levelName";
    public static final String FN_MEMBERDETAIL = "memberDetail";
    public static final String FN_INTEGRAL = "integral";
    public static final String FN_INTEGRALDETAIL = "integralDetail";
    public static final String FN_PERSONNUMBER = "personNumber";
    public static final String FN_ERCODE = "erCode";
    public static final String FN_LISTS = "lists";
    
    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_NICKNAME,
             FN_AVATARURL,
             FN_LEVEL,
             FN_LEVELNAME,
             FN_MEMBERDETAIL,
             FN_INTEGRAL,
             FN_INTEGRALDETAIL,
             FN_PERSONNUMBER,
             FN_ERCODE,
             FN_LISTS);
    
    private String nickName;
    private String avatarUrl;
    private String level;
    private String levelName;
    private String memberDetail;
    private Integer integral;
    private String integralDetail;
    private String personNumber;
    private String erCode;
    private List<CardBO> lists;
    
    public MainBO(String nickName, String avatarUrl, String level, String levelName, String memberDetail, Integer integral, String integralDetail, String personNumber, String erCode, List<CardBO> lists) {
        setNickName(nickName);
        setAvatarUrl(avatarUrl);
        setLevel(level);
        setLevelName(levelName);
        setMemberDetail(memberDetail);
        setIntegral(integral);
        setIntegralDetail(integralDetail);
        setPersonNumber(personNumber);
        setErCode(erCode);
        setLists(lists);
    }
    
    public MainBO() {
    }
    
    public MainBO duplicate() {
        MainBO result = new MainBO();
        result.nickName = this.nickName;
        result.avatarUrl = this.avatarUrl;
        result.level = this.level;
        result.levelName = this.levelName;
        result.memberDetail = this.memberDetail;
        result.integral = this.integral;
        result.integralDetail = this.integralDetail;
        result.personNumber = this.personNumber;
        result.erCode = this.erCode;
        result.lists = this.lists == null ? null : this.lists.stream().map(e1->e1 == null ? null : e1.duplicate()).collect(Collectors.toList());
        return result;
    }
    
    @Override
    public String toString() {
        return Convert.toJson(this);
    }
    
    public String getNickName() {
        return nickName;
    }
    
    public void  setNickName(String value) {
        this.nickName = value;
    }
    
    public MainBO withNickName(String value) {
        setNickName(value);
        return this;
    }
    
    public MainBO withNickName(String value, String defaultValue) {
        setNickName(value == null ? defaultValue : value);
        return this;
    }
    
    public String getAvatarUrl() {
        return avatarUrl;
    }
    
    public void  setAvatarUrl(String value) {
        this.avatarUrl = value;
    }
    
    public MainBO withAvatarUrl(String value) {
        setAvatarUrl(value);
        return this;
    }
    
    public MainBO withAvatarUrl(String value, String defaultValue) {
        setAvatarUrl(value == null ? defaultValue : value);
        return this;
    }
    
    public String getLevel() {
        return level;
    }
    
    public void  setLevel(String value) {
        this.level = value;
    }
    
    public MainBO withLevel(String value) {
        setLevel(value);
        return this;
    }
    
    public MainBO withLevel(String value, String defaultValue) {
        setLevel(value == null ? defaultValue : value);
        return this;
    }
    
    public String getLevelName() {
        return levelName;
    }
    
    public void  setLevelName(String value) {
        this.levelName = value;
    }
    
    public MainBO withLevelName(String value) {
        setLevelName(value);
        return this;
    }
    
    public MainBO withLevelName(String value, String defaultValue) {
        setLevelName(value == null ? defaultValue : value);
        return this;
    }
    
    public String getMemberDetail() {
        return memberDetail;
    }
    
    public void  setMemberDetail(String value) {
        this.memberDetail = value;
    }
    
    public MainBO withMemberDetail(String value) {
        setMemberDetail(value);
        return this;
    }
    
    public MainBO withMemberDetail(String value, String defaultValue) {
        setMemberDetail(value == null ? defaultValue : value);
        return this;
    }
    
    public Integer getIntegral() {
        return integral;
    }
    
    public void  setIntegral(Integer value) {
        this.integral = value;
    }
    
    public MainBO withIntegral(Integer value) {
        setIntegral(value);
        return this;
    }
    
    public MainBO withIntegral(Integer value, Integer defaultValue) {
        setIntegral(value == null ? defaultValue : value);
        return this;
    }
    
    public String getIntegralDetail() {
        return integralDetail;
    }
    
    public void  setIntegralDetail(String value) {
        this.integralDetail = value;
    }
    
    public MainBO withIntegralDetail(String value) {
        setIntegralDetail(value);
        return this;
    }
    
    public MainBO withIntegralDetail(String value, String defaultValue) {
        setIntegralDetail(value == null ? defaultValue : value);
        return this;
    }
    
    public String getPersonNumber() {
        return personNumber;
    }
    
    public void  setPersonNumber(String value) {
        this.personNumber = value;
    }
    
    public MainBO withPersonNumber(String value) {
        setPersonNumber(value);
        return this;
    }
    
    public MainBO withPersonNumber(String value, String defaultValue) {
        setPersonNumber(value == null ? defaultValue : value);
        return this;
    }
    
    public String getErCode() {
        return erCode;
    }
    
    public void  setErCode(String value) {
        this.erCode = value;
    }
    
    public MainBO withErCode(String value) {
        setErCode(value);
        return this;
    }
    
    public MainBO withErCode(String value, String defaultValue) {
        setErCode(value == null ? defaultValue : value);
        return this;
    }
    
    public List<CardBO> getLists() {
        if( lists == null) {
            lists = Lists.newArrayList();
        }
        return lists;
    }
    
    public void  setLists(List<CardBO> value) {
        this.lists = value;
    }
    
    public MainBO withLists(List<CardBO> value) {
        setLists(value);
        return this;
    }
    
    public MainBO withLists(List<CardBO> value, List<CardBO> defaultValue) {
        setLists(value == null ? defaultValue : value);
        return this;
    }
    
    public MainBO addLists(CardBO value) {
        if(lists == null) {
            lists = Lists.newArrayList();
        }
        this.lists.add(value);
        return this;
    }
    
    public Object getValueOf(String name) {
        switch(name) {
        case "nickName": return getNickName();
        case "avatarUrl": return getAvatarUrl();
        case "level": return getLevel();
        case "levelName": return getLevelName();
        case "memberDetail": return getMemberDetail();
        case "integral": return getIntegral();
        case "integralDetail": return getIntegralDetail();
        case "personNumber": return getPersonNumber();
        case "erCode": return getErCode();
        case "lists": return getLists();
        }
        return null;
    }
    
    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }
    
    @Override
    public int hashCode() {
        return signature().hashCode();
    }
    
    @Override
    public boolean equals(Object o) {
        if(!(o instanceof MainBO)) return false;
        return signature().equals(((MainBO)o).signature());
    }
    
    public String signature() {
        throw new RuntimeException("Bean MainBO has no signature defined, no hash code or equals possible.");
    }
}
